import java.util.Random;
import java.util.Scanner;

class Exer {

    public static void move(char pose1, char pose2) {
        System.out.print(pose1 + " => " + pose2 + "  ");
    }

    public static void hanio(int n, char pose1, char pose2, char pose3) {
        if (n == 1) {
            move(pose1, pose3);
            return;
        }

        hanio(n - 1, pose1, pose3, pose2);
        move(pose1, pose3);
        hanio(n - 1, pose2, pose1, pose3);


    }


    public static void main(String[] args) {
        hanio(1, 'A', 'B', 'C');
        System.out.println();
        hanio(2, 'A', 'B', 'C');
        System.out.println();
        hanio(3, 'A', 'B', 'C');
        System.out.println();

    }
}

class Jump {

    public static int jump(int n) {

        if (n == 1) {
            return 1;
        }
        if (n == 2) {
            return 2;
        }
        return jump(n - 1) + jump(n - 2);
    }

    public static void main(String[] args) {
        int n = 3;
        int m = 5;
        System.out.println(jump(n));
        System.out.println(jump(m));
    }
}

//class Exer1 {
//    public static int print(int num) {
//        if (num > 9) {
//            System.out.println(num / 10);
//        }
//        System.out.println(num % 10);
//        return num;
//    }
//
//    public static void main(String[] args) {
//        int num = 1234;
//        System.out.println(new PrintStream(num));
//
//    }
//}


class Test {
    public static void main1(String[] args) {

        int num = 10;
        if (num % 2 == 0) {
            System.out.println("num 是偶数");
        } else {
            System.out.println("num 是奇数");
        }

    }

    public static void main2(String[] args) {
        int x = 10;
        int y = 10;
        if (x == 10)
            if (y == 10)
                System.out.println("haha");
            else
                System.out.println("hehe");
    }

    public static void main3(String[] args) {
        int day = 1;
        switch (day) {
            case 1:
                System.out.println("星期一");
            case 2:
                System.out.println("星期二");
                break;
        }
    }

    //    public static void main4(String[] args) {
//        double num =1.0;
//        switch (num){
//            case 1.0:
//                System.out.println("111");
//                break;
//            case 2.0:
//                System.out.println("222");
//                break;
//        }
//    }
    public static void main(String[] args) {
        int num = 1;
        int sum = 0;
//        while (num<=10){
//            System.out.println(num);
//            num++;
//        }

        while (num <= 100) {
            sum += num;
            num++;
        }
        System.out.println(sum);
    }

}

class Test1 {
    public static void main(String[] args) {

        int num = 1;
        int sum = 0;

        while (num <= 5) {
            int factorResult = 1;
            int temp = 1;
            while (temp <= num) {
                factorResult *= temp;
            }
            sum += factorResult;
            num++;
        }

        System.out.println(sum);
    }
}

class Test2 {
    public static void main(String[] args) {

        int num = 100;
        while (num <= 200) {
            if (num % 3 != 0) {
                num++; // 这里的 ++ 不要忘记! 否则会死循环.
                continue;
            }
            System.out.println("找到了 3 的倍数, 为:" + num);
            num++;
        }
    }
}

class Test3 {
    public static void main(String[] args) {
//        int sum=0;
//        for (int i = 0; i <= 10; i++) {
//            sum += i;
//        }
//        System.out.println(sum);


//        int temp = 1;
//        for (int i = 1; i <= 5; i++) {
//             temp *=i;
//        }
//        System.out.println(temp);

//        int result = 1;
//        for (int i=1;i<=5;i++){
//            result *= i;
//        }
//        System.out.println(result);

//        int sum=0;
//        for (int i=1;i<=5;i++){
//            int temp =1;
//            for (int j=1;j<=i;j++){
//                temp *= j;
//            }
//            sum += temp;
//        }
//        System.out.println(sum);

        Scanner scan = new Scanner(System.in);
        double sum = 0.0;
        int num = 0;
        while (scan.hasNextDouble()) {
            double tmp = scan.nextDouble();
            sum += tmp;
            num++;
        }
        System.out.println("sum = " + sum);
        System.out.println("avg = " + sum / num);
        scan.close();
    }
}

class Test4 {
    public static void main(String[] args) {

        Random random = new Random();// 默认随机种子是系统时间
        Scanner scan = new Scanner(System.in);
        int guess = random.nextInt(100);
        while (true) {
            System.out.println("请输入要输入的数字: (1-100)");
            int num = scan.nextInt();
            if (num < guess) {
                System.out.println("低了");
            } else if (num > guess) {
                System.out.println("高了");
            } else {
                System.out.println("猜对了");
                break;
            }
        }
        scan.close();
    }
}

class Test5 {
    public static int add(int i, int j) {
        //返回值
        return i + j;
    }

    public static void main(String[] args) {
        int a = 10;
        int b = 20;

        //方法的调用
        System.out.println(add(a, b));

    }
}

class Test6 {
    public static int add(int x, int y) {
        System.out.println("调用方法中 x = " + x + " y = " + y);
        return x + y;
    }

    public static void main(String[] args) {
        int a = 10;
        int b = 20;
        System.out.println("调用方法之前");
        int ret = add(a, b);
        System.out.println("第一次调用方法之后");
        System.out.println("ret = " + ret);

        System.out.println("第二次调用方法之前");
        ret = add(30, 50);
        System.out.println("第二次调用方法之后");
        System.out.println("ret = " + ret);

    }
}

class Test7 {
    public static int factorial(int n) {
        System.out.println("计算 n 的阶乘当中 n = " + n);
        int result = 1;
        for (int i = 1; i <= n; i++) {
            result *= i;
        }
        return result;
    }

    public static void main(String[] args) {
        int sum = 0;
        for (int i = 1; i <= 5; i++) {
            sum += factorial(i);
        }
        System.out.println("sum = " + sum);
    }
}

class Test8 {

    public static void swap(int x, int y) {
        int temp = x;
        x = y;
        y = temp;
    }

    public static void main(String[] args) {
        int a = 10;
        int b = 20;
        swap(a, b);
        System.out.println(" a = " + a + " b = " + b);
    }
}

class Test9 {
    public static void swap(int[] arr) {
        int temp = arr[0];
        arr[0] = arr[1];
        arr[1] = temp;
    }

    public static void main(String[] args) {
        int[] arr = {10, 20};
        swap(arr);
        System.out.println("a = " + arr[0] + " b = " + arr[1]);
    }
}

class Test10 {
    public static void print(int x, int y) {
        System.out.println("x = " + x + " y = " + y);
    }

    public static void main(String[] args) {
        int a = 10;
        int b = 20;
      print(a, b);
    }
}